<?php
/**
 * excel导出服务
 * panglishan
 * 2020.08.01
 */
namespace App\Services\Tools;

use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\WithHeadings;

class ExportService implements FromCollection, WithHeadings
{

    use Exportable;

    private $data;
    private $headings;

    public function __construct($data, $headings)
    {
        $this->data = $data;
        $this->headings = $headings;
    }

    public function collection()
    {

        return collect($this->data);

    }


    public function headings(): array
    {

        return $this->headings;
    }

}